﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PersonalWebSite.Common
{
    /// <summary>
    /// Defines extension methods
    /// </summary>
    public static class Extensions
    {
        /// <summary>
        /// Gets the Value in the dictionary for the given key if the key exists, null otherwise
        /// </summary>
        /// <param name="dictionary">dictionary</param>
        /// <param name="key">Dictionary Key</param>
        /// <returns>Value in the dictionary for the given key if the key exists, null otherwise</returns>
        public static object Val(this Dictionary<string, object> dictionary, string key)
        {
            return dictionary.ContainsKey(key) ? dictionary[key] : null;
        }
    }
}